import request from "@/utils/request";
const BASE_URL = "/customers";

const RegionAPI = {
  getList(queryParams: IPageQuery) {
    return request<any, PageResult<IPageVO[]>>({
      url: `${BASE_URL}/getRegionList`,
      method: "get",
      params: queryParams,
      data: queryParams,
    });
  },

  getFormData(id: number) {
    return request({
      url: `${BASE_URL}/region/${id}`,
      method: "get",
    });
  },

  add(data: IForm) {
    return request({
      url: `${BASE_URL}/addRegion`,
      method: "post",
      data: data,
    });
  },

  update(data: IForm) {
    return request({
      url: `${BASE_URL}/updateRegion`,
      method: "POST",
      data: data,
    });
  },

  deleteByIds(id: number) {
    return request({
      url: `${BASE_URL}/deleteRegion/${id}`,
      method: "get",
    });
  },
};

export default RegionAPI;
export interface IPageVO {
  customerId: number;
  customerName: string;
}

export interface IPageQuery extends PageQuery {
  customerName?: string;
}
export interface IForm {
  customerId?: number;
  customerName: string;
}
